package hot100;

public class reverseList {
    public mergeKLists.ListNode reverseList(mergeKLists.ListNode head) {
        if (head == null || head.next == null) {
            return head;
        }
        mergeKLists.ListNode curN = head.next;
        mergeKLists.ListNode cur = head;
        cur.next = null;
        while (curN != null) {
            cur = curN;
            curN = curN.next;
            cur.next = head;
            head = cur;
        }
        return cur;
    }
}
